package com.partner.bean.login;

import java.text.ParseException;

import javax.validation.constraints.Pattern;

import com.partner.frame.*;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;  

@SuppressWarnings("serial")
public class Userinfo extends BaseBean {
	
	/**
      * Bean Validation 中内置的 constraint       
      * @Null   被注释的元素必须为 null       
      * @NotNull    被注释的元素必须不为 null       
      * @AssertTrue     被注释的元素必须为 true       
      * @AssertFalse    被注释的元素必须为 false       
      * @Min(value)     被注释的元素必须是一个数字，其值必须大于等于指定的最小值       
      * @Max(value)     被注释的元素必须是一个数字，其值必须小于等于指定的最大值       
      * @DecimalMin(value)  被注释的元素必须是一个数字，其值必须大于等于指定的最小值       
      * @DecimalMax(value)  被注释的元素必须是一个数字，其值必须小于等于指定的最大值       
      * @Size(max=, min=)   被注释的元素的大小必须在指定的范围内       
      * @Digits (integer, fraction)     被注释的元素必须是一个数字，其值必须在可接受的范围内       
      * @Past   被注释的元素必须是一个过去的日期       
      * @Future     被注释的元素必须是一个将来的日期       
      * @Pattern(regex=,flag=)  被注释的元素必须符合指定的正则表达式       
      * Hibernate Validator 附加的 constraint       
      * @NotBlank(message =)   验证字符串非null，且长度必须大于0       
      * @Email  被注释的元素必须是电子邮箱地址       
      * @Length(min=,max=)  被注释的字符串的大小必须在指定的范围内       
      * @NotEmpty   被注释的字符串的必须非空       
      * @Range(min=,max=,message=)  被注释的元素必须在合适的范围内 
      */
	
	private String id;
	
	@NotBlank(message = "{account.is.null}")
	@Pattern(regexp="^((13[0-9])|(14[5,7,9])|(15[^4,\\D])|(17[0,1,3,5-8])|(18[0-9]))\\d{8}$", message="{account.format.error}")
	private String account;
	private String chname;
	// 6-18 位，字母、数字、字符
	@NotBlank(message = "{password.is.null}")
	@Length(max=18,min=6,message = "{password.length.error}")
	private String password;
	private String enname;
	private String headimg;
	private String sex;
	private String mobile;
	private String regeistdate ; 
	@Email(message = "{Email.formaterror}")
	private String email;
	private String province ; 
	private String city;
	@Length(max=15,min=0,message = "{length.15.error}")
	private String job;
	private String state;
	private String lastlogintime ;
	private String devicetoken ; 
	private String lastlogindevice ;
	private String online; //是否在线
	private String session;
	@Length(max=15,min=0,message = "{length.15.error}")
	private String position; //岗位
	@Length(max=15,min=0,message = "{length.15.error}")
	private String company ; //公司
	
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getAccount() {
		return account;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public String getChname() {
		return chname;
	}
	public void setChname(String chname) {
		this.chname = chname;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getEnname() {
		return enname;
	}
	public void setEnname(String enname) {
		this.enname = enname;
	}
	public String getHeadimg() {
		return headimg;
	}
	public void setHeadimg(String headimg) {
		this.headimg = headimg;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getJob() {
		return job;
	}
	public void setJob(String job) {
		this.job = job;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getDevicetoken() {
		return devicetoken;
	}
	public void setDevicetoken(String devicetoken) {
		this.devicetoken = devicetoken;
	}
	public String getLastlogindevice() {
		return lastlogindevice;
	}
	public void setLastlogindevice(String lastlogindevice) {
		this.lastlogindevice = lastlogindevice;
	}
	public String getOnline() {
		return online;
	}
	public void setOnline(String online) {
		this.online = online;
	}
	public String getSession() {
		return session;
	}
	public void setSession(String session) {
		this.session = session;
	}
	public String getRegeistdate() throws ParseException {
		java.text.DateFormat df = new java.text.SimpleDateFormat(
				"yyyy-MM-dd HH:mm");
		if(regeistdate!=null&&!regeistdate.equals("")){
			return df.format(df.parse(regeistdate));
		}else{
			return "" ;
		}
		
	}
	public void setRegeistdate(String regeistdate) {
		this.regeistdate = regeistdate;
	}
	public String getLastlogintime() throws ParseException {
		
		java.text.DateFormat df = new java.text.SimpleDateFormat(
				"yyyy-MM-dd HH:mm");
		if(regeistdate!=null&&!regeistdate.equals("")){
			return df.format(df.parse(lastlogintime));
		}else{
			return "" ;
		}
	}
	public void setLastlogintime(String lastlogintime) {
		this.lastlogintime = lastlogintime;
	}
	public String getPosition() {
		return position;
	}
	public void setPosition(String position) {
		this.position = position;
	}
	public String getCompany() {
		return company;
	}
	public void setCompany(String company) {
		this.company = company;
	}

}
